#include "friendlabel.h"
#include "ui_friendlabel.h"
FriendLabel::FriendLabel(QWidget *parent)
    : QFrame(parent)
    , ui(new Ui::FriendLabel)
{
    ui->setupUi(this);
}

FriendLabel::~FriendLabel()
{
    delete ui;
}

void FriendLabel::setText(QString text)
{
    _text = text;
    ui->tip_lb->setText(_text);
    ui->tip_lb->adjustSize();
    _width = ui->tip_lb->width() + ui->close_btn->width() + 10;
    _height = ui->close_btn->height() + 2;
    this->setFixedWidth(_width);
    this->setFixedHeight(_height);
}

int FriendLabel::width()
{
    return _width;
}

int FriendLabel::height()
{
    return _height;
}

QString FriendLabel::text()
{
    return _text;
}

void FriendLabel::on_close_btn_clicked()
{
    emit sig_close(_text);
}
